//
//  CommonDAO.m
//  Guazi
//
//  Created by koolearn on 11-4-23.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <sqlite3.h>
#import "CommonDAO.h"
#import "DBConnection.h"


@implementation CommonDAO

const char *delete_message_cache_sql = 
"BEGIN;"
"DELETE FROM statuses;"
"DELETE FROM direct_messages;"
"DELETE FROM users;"
"DELETE FROM followees;"
"COMMIT;"
"VACUUM;";

+ (void)deleteLocalCaches
{
    char *errmsg;
	sqlite3* theDatabase = [DBConnection getDatabase];
    
    if (sqlite3_exec(theDatabase, delete_message_cache_sql, NULL, NULL, &errmsg) != SQLITE_OK) {
        // ignore error
        NSLog(@"Error: failed to cleanup chache (%s)", errmsg);
    }
}


@end

